<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <div>{{num|cheng|two}}</div>
      <div>{{msg}}</div>
    </div>
    <div id="root">
      <div>{{num|cheng|two}}</div>
      <div>{{msg}}</div>
    </div>
    <script src="vue.js"></script>
    <script>
      var Mixin = {
        data() {
          return {
            msg: '消息'
          }
        },
        methods: {
          getcookie() {
            console.log(6666)
          }
        },
        created() {},
        filters: {
          two: function(value) {
            return value.toFixed(2)
          },
          cheng: function(value) {
            return value * 10
          }
        }
      }
      var vm = new Vue({
        el: '#app',
        mixins: [Mixin],
        data() {
          return {
            kkk: '111',
            num: 1231.298346826
          }
        },
        mounted() {
          this.getcookie()
        }
      })
      //全局混入
      Vue.mixin(Mixin)
      var vm1 = new Vue({
        el: '#root',
        data() {
          return {
            num: 12391.2123
          }
        },
        methods: {},
        mounted() {
          this.getcookie()
        }
      })
    </script>
  </body>
</html>
